<template>
	<view class="container">
		<view class="btn-box">
			<button @getuserinfo="getUserInfo" open-type="getUserInfo" type="primary">允许获取您的微信昵称和头像</button>
		</view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				
			}
		},
		
		methods: {
			
			getUserInfo(res) {
				if (res.detail.userInfo) {
					uni.setStorageSync('wechatUserInfo', res.detail.userInfo)
					uni.redirectTo({
					  url: '/pages/login/login'
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '您拒绝授权，无法正常使用我们的服务',
						showCancel: false
					})
				}
			}
			
		}
	}
</script>

<style>
	.container {
		width: 750rpx;
		height: 100%;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}
	
	.btn-box {
		width: 600rpx;
		height: 60rpx;
		margin-top: 500rpx;
	}
	
	button {
		font-size: 36rpx !important;
		background-color: #5683ec !important;
	}
</style>
